# Makefile
export ARCH				:= arm
export LINUX_KERNEL_SRC	:= /home/zhangfei/share-zhang/aplatform/private/trunk/am335x/board-support/linux-4.4.41+gitAUTOINC+f9f6f0db2d-gf9f6f0db2d
export CROSS_COMPILE	:= arm-linux-gnueabihf-
export CC				:= $(CROSS_COMPILE)gcc

current_dir			:=$(PWD)
sub_dirs			:=$(shell ls -l ./ |awk '/^d/ {print $$NF}')
src_files			:=$(subst ./, , $(foreach dir,.,$(wildcard $(dir)/*.c)) ) 
src_files			+=$(subst ./, , $(foreach dir,$(sub_dirs),$(wildcard $(dir)/*.c)) ) 
obj_files     		:=$(subst .c,.o, $(src_files) )

obj-m				:=osal.o
osal-y				:=osal_module.o \
					osal_fs/osal_proc.o \
					osal_log/osal_log.o \
					osal_driver/osal_class.o \
					osal_task/osal_kthread.o \
					osal_schedule/osal_wait_queue.o

EXTRA_CFLAGS		:= -I$(current_dir)/osal_include -I$(current_dir)/osal_log


all:
	make -C $(LINUX_KERNEL_SRC) M=$(PWD) $(EXTRA_CFLAGS) modules

clean:
	make -C $(LINUX_KERNEL_SRC) M=$(PWD) clean 